

/**
 * 判断 includes 中是否存在 str 包含的字符串
 * @param str 
 * @param includes 
 * @returns 
 */
export function includesStrings(str: string, includes: string[]) {
    return includes.some(inc => str.includes(inc));
}



/**
 * 判断 includes 中是否存匹配 str 的正则
 * @param str 
 * @param includes 
 * @returns 
 */
export function includesRegExps(str: string, includes: RegExp[]) {
    return includes.some(inc => inc.test(str));
}
/**
 * 判断 includes 中是否存匹配 str 的模式
 * @param str 
 * @param includes 
 * @returns 
 */
export function includesPatterns(str: string, includes: (string|RegExp)[]) {
    return includes.some(function (inc){
        if(typeof inc === "string") return str.includes(inc);
        return inc.test(str);
    });
}

